package com.charley.icloud.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.charley.icloud.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUserEntity> {
    /*
    * 查询所有
    * @param page
    * @return 用户列表
    * */
    List<SysUserEntity> findAll(Page<SysUserEntity> page);

    /*
    * 根据用户名查询
    * @param username
    * @return 具体用户
    * */
    SysUserEntity findByUsername(String username);

    /*
     * 根据账号查询
     * @param username
     * @return 具体用户
     * */
    SysUserEntity findByAccount(String account);

    /*
    * 批量插入
    * @param users
    * */
    void batchInsert(List<SysUserEntity> users);

    /*
    * 批量更新
    * @param users
    * */
    void batchUpdate(List<SysUserEntity> users);

    /*
    * 批量查询哪些用户已存在，返回列表的index
    * @param usernameList
    * @return
    * */
    List<String> getExistByUsernameList(List<String> usernameList);
}
